import Chat from "../src/chat";
import * as R from "ramda";
import { expect, test } from "@jest/globals";
const chat = new Chat({
  user: {
    id: "user_id",
    avatar: "user_avatar",
    name: "user_name",
  },
  assistant: {
    id: "assistant_id",
    avatar: "assistant_avatar",
    name: "assistant_name",
  },
  room_id: "room_id",
});

test("chat", () => {
  expect(chat.user_id).toEqual("user_id");
  expect(chat.user_avatar).toEqual("user_avatar");
  expect(chat.user_name).toEqual("user_name");
  expect(chat.assistant_id).toEqual("assistant_id");
  expect(chat.assistant_avatar).toEqual("assistant_avatar");
  expect(chat.assistant_name).toEqual("assistant_name");
  expect(chat.room_id).toEqual("room_id");
});

test("chat send", () => {
  chat.onSend("hello", (message) => {
    expect(message).toEqual("hello");
  });
});

test("chat receive", () => {
  R.forEach(
    (word) => {
      chat.receive(word);
    },
    ["hello", "world", "test"]
  );
  expect(chat.word_list).toEqual(["hello", "world", "test"]);
});
